var sumfrom = function() {
    let reg = /^[a-zA-Z0-9]{3,10}$/,
        username = document.getElementById("username")
    pwd = document.getElementById("password")
    pwd2 = document.getElementById("password2")

    if (reg.test(username.value)) {
        if (pwd.value.length >= 8 && pwd.value.length <= 16) {
            if (pwd2.value === pwd.value) {
                return true;
            } else {
                alert("两次密码不一致")
            }
        } else {
            alert("密码长度必须在8-16位数之间")
        }
    } else {
        alert("用户名不正确")
    }
    return false;
}